package com.lagou.mapper;

import com.lagou.pojo.Order;
import com.lagou.pojo.User;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zhouzijia
 * @version 1.0
 * @description
 * @date 2020/11/8 15:12
 */
public interface OrdersMapper {

    List<Order> findOrderAndUser();

    List<Order> findAll();

    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "orderTime", column = "ordertime"),
            @Result(property = "total", column = "total"),
            @Result(property = "user", column = "uid", javaType = User.class, one= @One(
                    select = "com.lagou.mapper.UserMapper.findUserById"
            ))
    })
    @Select("select * from Orders ")
    List<Order> findOrderAndUser2();
}
